function [uout] = pad(u, n)
  % pad an array to n elements
  % arrays must be single dimensional.
    
uout = u;

m=length(u);
  if(m < n)
    uout(m+1:n)=NaN;
  end;
  return;
  
